package com.atguigu.canal;

import com.alibaba.otter.canal.protocol.exception.CanalClientException;
import com.atguigu.canal.client.Canalclient;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import javax.annotation.Resource;

@SpringBootApplication
public class CanalApplication implements CommandLineRunner {
    @Resource
    private Canalclient canalClient;
    public static void main(String[] args) {
        SpringApplication.run(CanalApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        //项目启动，执行canal客户端监听
        try{
            canalClient.run();

        }catch (CanalClientException e ){

            e.printStackTrace();
        }
    }
}
